package com.fingard.dsp.bank.reqrespobj.balancecheck;

import com.fingard.FGBiz;
import com.fingard.constant.Format;
import com.fingard.dsp.bank.directbank.specialDeal.BankAreaHelper;
import com.fingard.dsp.bank.reqrespobj.ReqRespHeader;
import com.fingard.dsp.bank.reqrespobj.RequestBase;
import com.fingard.text.StringHelper;
import com.fingard.xml.XmlTextReader;

import java.text.ParseException;
import java.util.Date;

/**
 * Created by F on 2017/6/5.
 */
public class ReqBalCheckQry extends RequestBase {
    public String actNum;

    public String actName;

    public String cellPhone;

    /**对账月份，格式yyyyMM*/
    public String yearMonth;
    
    /**账号地区区域码*/
    public String actArea;

    /**币种*/
    public String actCur;

    private XmlTextReader xmlReader;
    public ReqBalCheckQry(XmlTextReader p_xmlReader, ReqRespHeader p_header) throws Exception{
        reqHeader = p_header;
        xmlReader = p_xmlReader;
        actArea = p_xmlReader.getSimpleText("ActArea");
        if (FGBiz.dspCenter.convertBankArea) {
            BankAreaHelper bankAreaHelper=new BankAreaHelper(p_header.bankCode, actArea,"");
            bankAreaHelper.toBank();
            actArea=bankAreaHelper.bankAreaCode;
        }
        actCur = p_xmlReader.getSimpleText("ActCur");
        actNum = xmlReader.getSimpleText("ActNum");
        actName = xmlReader.getSimpleText("ActName");
        cellPhone = xmlReader.getSimpleText("CellPhone");
        if(StringHelper.hasAnyChar(xmlReader.getSimpleText("YearMonth"))){
        	yearMonth = xmlReader.getSimpleText("YearMonth");
        }else{
        	yearMonth = xmlReader.getSimpleText("NoteDate");
        }
        
    }
    
    /**取对账月份*/
    public Date getYearMonth() throws ParseException {
        return Format.Date6YearMonth.parse(yearMonth);
    }

}
